package com.tjcu.service.impl;

import com.tjcu.dao.UserMapper;
import com.tjcu.entity.User;
import com.tjcu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 通过姓名和密码查询用户
     * @param userName
     * @param password
     * @return
     */
    @Override
    public User getUser(String userName, String password) {
        User user=userMapper.login(userName,password);
        return user;
    }
    @Override
    public void insertToken(Integer userId, String token) {

        userMapper.insertToken(userId,token);
    }


    @Override
    public User getUserInfo(int id) {
        return userMapper.getUserInfo(id);
    }

    @Override
    public void updateImg(User user) {

        userMapper.updateImg(user);
    }

    @Override
    public void updateInfo(User user) {
        userMapper.updateInfo(user);
    }

    @Override
    public void updatePsw(User user) {
        userMapper.updatePsw(user);
    }

    @Override
    public String getPsw(int id) {
        return userMapper.getPsw(id);
    }


}
